package day16;

public class Draw {
    public static void main(String[] args) {
        FcctoryA fa=new FcctoryA();
        FcctoryB fb=new FcctoryB();
        FcctoryC fc=new FcctoryC();
        Shapes s1= fa.StartDraw();
        Shapes s2= fb.StartDraw();
        Shapes s3= fc.StartDraw();
        s1.draw();
        s2.draw();
        s3.draw();
    }
}

interface Shapes{
    void draw();
}

class CircleFactory implements Shapes{
    public void draw() {
        System.out.println("开始绘制圆形！");
    }
}
class RectangleFactory implements Shapes{
    public void draw() {
        System.out.println("开始绘制矩形！");
    }
}
class TriangleFactory implements Shapes{
    public void draw() {
         System.out.println("开始绘制三角形！");
    }
}

interface Factory{
    Shapes StartDraw();
}

class FcctoryA implements Factory{
    public Shapes StartDraw() {
        return new CircleFactory();
    }
}
class FcctoryB implements Factory{
    public Shapes StartDraw() {
        return new RectangleFactory();
    }
}
class FcctoryC implements Factory{
    public Shapes StartDraw() {
        return new TriangleFactory();
    }
}